package com.yjy.fuyao.sta.controller;


import com.yjy.fuyao.sta.service.StatisticsDailyService;
import com.yjy.fuyao.utils.result.R;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * <p>
 * 网站统计日数据 前端控制器
 * </p>
 *
 * @author yjy
 * @since 2021-08-27
 */
@RestController
@RequestMapping("/admin/sta/statistics-daily")
public class StatisticsDailyController {

    @Resource
    private StatisticsDailyService dailyService;

//    @PostMapping("/create/{day}")
//    public R createStatisticsByDate(@PathVariable String day) {
//        dailyService.createStatisticsByDay(day);
//        return R.ok();
//    }

    @GetMapping("show-chart/{begin}/{end}/{type}")
    public R showChart(@PathVariable String begin,@PathVariable String end,@PathVariable String type){
        Map<String, Object> map = dailyService.getChartData(begin, end, type);
        return R.ok().data(map);
    }

    @GetMapping("addRegisterNum")
    public R addRegisterNum(){
        boolean result = dailyService.AddRegisterNum();
        return R.ok().data("result",result);
    }

    @GetMapping("addLoginNum")
    public R addLoginNum(){
        boolean result = dailyService.AddLoginNum();
        return R.ok().data("result",result);
    }

    @GetMapping("addCourseNum")
    public R addCourseNum(){
        boolean result = dailyService.AddCourseNum();
        return R.ok().data("result",result);
    }

    @GetMapping("addVideoViewNum")
    public R addVideoViewNum(){
        boolean result = dailyService.AddVideoViewNum();
        return R.ok().data("result",result);
    }

}

